﻿Imports System.ComponentModel
Imports DevExpress.LookAndFeel
Imports System.Linq
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.Parameters


Public Class fROrcamentoUNGeral1
    Public arm As String
    Dim db As New LinqGeralDataContext

    Sub New()
        InitSkins()
        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub
    Sub InitSkins()
        DevExpress.Skins.SkinManager.EnableFormSkins()
        DevExpress.UserSkins.BonusSkins.Register()
        UserLookAndFeel.Default.SetSkinStyle("Metropolis")
    End Sub

    Private Sub SimpleButton1_Click(sender As Object, e As EventArgs) Handles SimpleButton1.Click
        If ComboBoxEdit1.Text Is Nothing Or ComboBoxEdit2.Text Is Nothing Then

        Else
            'Dim arm As String
            If ComboBoxEdit2.Text = "Geral" Then
                arm = "%"
            Else
                arm = ComboBoxEdit2.Text
            End If
            ' MessageBox.Show(arm)
            ' MessageBox.Show(ComboBoxEdit1.Text)
            Me.TblROrcamentoUNGeralTableAdapter1.Fill(DsManutOrcamento1.tblROrcamentoUNGeral, GlobalVariables.Empresa, arm, ComboBoxEdit1.Text)

            Dim Report As New ROrcamentoUNGeral

            Report.armazemr = ComboBoxEdit2.Text


            Report.RequestParameters = False

            Report.DataAdapter = Me.TblROrcamentoUNGeralTableAdapter1
            ' Bind the report's printing system to the print control. 
            PrintControl1.PrintingSystem = Report.PrintingSystem


            ' Generate the report's print document. 
            Report.CreateDocument()
        End If
    End Sub

    Private Sub fROrcamentoUNGeral1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim a = (From c In db.tblOrcamentos _
              Group c By c.ANO Into Group _
              Select ANO)


        For Each ano In a
            ComboBoxEdit1.Properties.Items.Add(ano.ToString)
        Next
    End Sub
End Class